package com.atguigu.lease.web.app.context;

import com.atguigu.lease.model.entity.UserInfo;

/**
 * ClassName:LoginUserContext
 * Package: com.atguigu.lease.web.app.context
 * Description:
 *
 * @Author Makabaka
 * @Create 2024/9/27 15:31
 * @Version 1.0
 */
public class LoginUserContext {

    private static final ThreadLocal<UserInfo> userThreadLocal = new ThreadLocal<>();

    public static void setLoginUser(UserInfo userInfo) {
        userThreadLocal.set(userInfo);
    }

    public static UserInfo getLoginUser() {
        return userThreadLocal.get();
    }

    public static void clear() {
        userThreadLocal.remove();
    }
}
